<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Taskflow Handbook</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname"><a href="https://taskflow.github.io/">Taskflow</a>
   &#160;<span id="projectnumber">3.0.0-Master-Branch</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('FAQ.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Frequently Asked Questions </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This page summarizes a list of frequently asked questions about Taskflow. If you cannot find a solution here, please post an issue at <a href="https://github.com/taskflow/taskflow/issues">here</a>.</p>
<h1><a class="anchor" id="GeneralQuestions"></a>
General Questions</h1>
<h2><a class="anchor" id="GeneralQuestion1"></a>
Q1: What's the goal of Taskflow?</h2>
<p>Taskflow aims to help C++ developers quickly implement efficient parallel decomposition strategies using task-based approaches.</p>
<h2><a class="anchor" id="GeneralQuestion2"></a>
Q2: How do I use Taskflow in my projects?</h2>
<p>Taskflow is a header-only library with zero dependencies. The only thing you need is a C++17 compiler. To use Taskflow, simply drop the folder <code>taskflow/</code> to your project and include taskflow.hpp.</p>
<h2><a class="anchor" id="GeneralQuestion3"></a>
Q3: What is the difference between static tasking and dynamic tasking?</h2>
<p>Static tasking refers to those tasks created before execution, while dynamic tasking refers to those tasks created during the execution of static tasks or dynamic tasks (nested). Dynamic tasks created by the same task node are grouped together to a subflow.</p>
<h2><a class="anchor" id="GeneralQuestion4"></a>
Q4: How many tasks can Taskflow handle?</h2>
<p>Benchmarks showed Taskflow can efficiently handle millions or billions of tasks (both large and small tasks) on a machine with up to 64 CPUs.</p>
<h2><a class="anchor" id="GeneralQuestion5"></a>
Q5: What is the weird hex value, like 0x7fc39d402ab0, in the dumped graph?</h2>
<p>The hex value represents the memory address of the task. Each task has a method <a class="el" href="classtf_1_1Task.html#a9057ecd0f3833b717480e914f8568f02" title="assigns a name to the task ">tf::Task::name(const std::string&amp;)</a> for user to assign a human readable string to ease the debugging process. If a task is not assigned a name or is an internal node, its address value in the memory is used instead.</p>
<h2><a class="anchor" id="GeneralQuestion6"></a>
Q6: Does Taskflow have backward compatibility with C++03/98/11/14?</h2>
<p>Unfortunately, Taskflow is heavily relying on modern C++17's features/idoms/STL and it is very difficult to provide a version that compiles under older C++ versions.</p>
<h2><a class="anchor" id="GeneralQuestion7"></a>
Q7: How does Taskflow schedule tasks?</h2>
<p>Taskflow implemented a very efficient <a href="https://en.wikipedia.org/wiki/Work_stealing">work-stealing scheduler</a> to execute task dependency graphs. The source code is available at <code><a class="el" href="executor_8hpp.html">taskflow/core/executor.hpp</a></code>.</p>
<h2><a class="anchor" id="GeneralQuestion8"></a>
Q8: What is the overhead of taskflow?</h2>
<p>Creating a taskflow has certain overhead. For example, creating a task and a dependency takes about 61 and 14 nanoseconds in our system (Intel 4-core CPU at 2.00GHz). The time is amortized over 1M operations, since we have implemented an object pool to recycle tasks for minimal overhead.</p>
<h2><a class="anchor" id="GeneralQuestion9"></a>
Q9: How does it compare to existing task programming systems?</h2>
<p>There is a large amount of work on programming systems (e.g., StarPU, Intel TBB, OpenMP, PaRSEC, Kokkos, HPX) in the interest of simplifying the programming complexity of parallel and heterogeneous computing. Each of these systems has its own pros and cons and deserves a reason to exist. However, they do have some problems, particularly from the standpoint of ease of use, static control flow, and scheduling efficiency. Taskflow addresses these limitations through a simple, expressive, and transparent graph programming model.</p>
<h2><a class="anchor" id="GeneralQuestion10"></a>
Q10: Do you try to simplify the GPU kernel programming?</h2>
<p>No, we do not develop new programming models to simplify the kernel programming. The rationale is simple: Writing efficient kernels requires domain-specific knowledge and developers often require direct access to the native GPU programming interface. High-level kernel programming models or abstractions all come with restricted applicability. Despite non-trivial kernel programming, we believe what makes heterogeneous computing difficult are surrounding tasks. A mistake made by task scheduling can outweigh all speed-up benefits from a highly optimized kernel. Therefore, Taskflow focuses on heterogeneous tasking that affects the overall system performance to a large extent.</p>
<h2><a class="anchor" id="GeneralQuestion11"></a>
Q11: Do you have any real use cases?</h2>
<p>We have applied Taskflow to solve many realistic workloads and demonstrated promising performance scalability and programming productivity. Please refer to <a class="el" href="usecases.html">Real Use Cases</a> and <a class="el" href="References.html">References</a>.</p>
<h2><a class="anchor" id="GeneralQuestion12"></a>
Q12: Who is the Principal Investigator of Taskflow I can talk to?</h2>
<p>Please visit this <a href="https://taskflow.github.io/#tag_contact">page</a> or email the investigator <a href="https://tsung-wei-huang.github.io/">Dr. Tsung-Wei Huang</a>.</p>
<h2><a class="anchor" id="GeneralQuestion13"></a>
Q13: Who are developing and maintaining Taskflow?</h2>
<p>Taskflow is in active development with core functionalities contributed by an academic group at the University of Utah, led by <a href="https://tsung-wei-huang.github.io/">Dr. Tsung-Wei Huang</a>. While coming out of an academic lab, Taskflow aims to be industrial-strength and is committed to long-term support.</p>
<h2><a class="anchor" id="GeneralQuestion14"></a>
Q14: Is Taskflow just an another API or model?</h2>
<p>OK, let me ask this first: <em>Is your new car just another vehicle? Or, is your new home just another place to live?</em></p>
<p>The answer to this question is the question itself. As technology advances, we can always find new ways to solve computational problems and achieve new performance milestones that were previously out-of-reach.</p>
<h2><a class="anchor" id="GeneralQuestion15"></a>
Q15: How can I contribute?</h2>
<p>New contributors are always welcome! Please visit <a class="el" href="Contributing.html">Contributing</a>.</p>
<hr/>
<h1><a class="anchor" id="ProgrammingQuestions"></a>
Programming Questions</h1>
<h2><a class="anchor" id="ProgrammingQuestions1"></a>
Q1: What is the difference between Taskflow threads and workers?</h2>
<p>The master thread owns the thread pool and can spawn workers to run tasks or shutdown the pool. Giving taskflow <code>N</code> threads means using <code>N</code> threads to do the works, and there is a total of <code>N+1</code> threads (including the master thread) in the program. Please refer to <a class="el" href="chapter2.html#C2_CreateAnExecutor">Create an Executor</a> for more details.</p>
<h2><a class="anchor" id="ProgrammingQuestions2"></a>
Q2: What is the Lifetime of a Task and a Graph?</h2>
<p>The lifetime of a task sticks with its parent graph. A task is not destroyed until its parent graph is destroyed. Please refer to <a class="el" href="chapter1.html#C1_LifetimeOfATask">Lifetime of A Task</a> for more details.</p>
<h2><a class="anchor" id="ProgrammingQuestions3"></a>
Q3: Is taskflow thread-safe?</h2>
<p>No, the taskflow object is not thread-safe. Multiple threads cannot create tasks from the same taskflow at the same time.</p>
<h2><a class="anchor" id="ProgrammingQuestions4"></a>
Q4: Is executor thread-safe?</h2>
<p>Yes, the executor object is thread-safe. You can have multiple threads run their taskflows on one executor.</p>
<h2><a class="anchor" id="ProgrammingQuestions5"></a>
Q5: My program hangs and never returns after dispatching a taskflow graph. What's wrong?</h2>
<p>When the program hangs forever it is very likely your taskflow graph has a cycle or not properly conditioned (see <a class="el" href="chapter4.html">C4: Conditional Tasking</a>). Try the <a class="el" href="classtf_1_1Taskflow.html#a4725d8ea5ff7595d9d71593360538e00" title="dumps the taskflow to a DOT format through an output stream that defines the stream insertion operato...">tf::Taskflow::dump</a> method to debug the graph before dispatching your taskflow graph.</p>
<h2><a class="anchor" id="ProgrammingQuestions6"></a>
Q6: In the following example where B spawns a joined subflow of two tasks B1 and B2, do they run concurrently with task A?</h2>
<div class="image">
<img src="dynamic_graph.png" alt="dynamic_graph.png" width="60%"/>
</div>
<p>No. The subflow is spawned during the execution of B, and at this point A must finish because A precedes B. This gives rise to the fact B1 and B2 must run after A. This graph may looks strange because B seems to run twice! However, B will run only once to create its subflow. Whether this subflow joins or detaches from B only affects the future object returned from B. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
